<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
























<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.1.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.1.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.1.0">


  <link rel="mask-icon" href="/images/logo.svg?v=7.1.0" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.1.0',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: false,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="读研期间做相关滤波视觉跟踪，读了很多相关滤波的论文，但是由于当年矩阵论和数字信号处理基础太菜，一直没搞明白相关滤波的闭合解是怎么推出来的，各种论文里面的推导都是直接给个结果，过程不详。最近终于搞明白了推导的过程和原理，在这里记录一下。我觉得应该是全网最清晰最易懂的相关滤波推导了。 如果不加说明，以下粗体字$\mathbf{x}$代表列向量，加帽$\hat{\mathbf{x}}$代表$\mathb">
<meta name="keywords" content="科研">
<meta property="og:type" content="article">
<meta property="og:title" content="清晰易懂版相关滤波推导">
<meta property="og:url" content="http://yoursite.com/2019/06/14/清晰易懂版相关滤波推导/index.html">
<meta property="og:site_name" content="soldatJiang的博客">
<meta property="og:description" content="读研期间做相关滤波视觉跟踪，读了很多相关滤波的论文，但是由于当年矩阵论和数字信号处理基础太菜，一直没搞明白相关滤波的闭合解是怎么推出来的，各种论文里面的推导都是直接给个结果，过程不详。最近终于搞明白了推导的过程和原理，在这里记录一下。我觉得应该是全网最清晰最易懂的相关滤波推导了。 如果不加说明，以下粗体字$\mathbf{x}$代表列向量，加帽$\hat{\mathbf{x}}$代表$\mathb">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-06-13T17:34:51.467Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="清晰易懂版相关滤波推导">
<meta name="twitter:description" content="读研期间做相关滤波视觉跟踪，读了很多相关滤波的论文，但是由于当年矩阵论和数字信号处理基础太菜，一直没搞明白相关滤波的闭合解是怎么推出来的，各种论文里面的推导都是直接给个结果，过程不详。最近终于搞明白了推导的过程和原理，在这里记录一下。我觉得应该是全网最清晰最易懂的相关滤波推导了。 如果不加说明，以下粗体字$\mathbf{x}$代表列向量，加帽$\hat{\mathbf{x}}$代表$\mathb">





  
  
  <link rel="canonical" href="http://yoursite.com/2019/06/14/清晰易懂版相关滤波推导/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>清晰易懂版相关滤波推导 | soldatJiang的博客</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript><!-- hexo-inject:begin --><!-- hexo-inject:end -->

</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">soldatJiang的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/06/14/清晰易懂版相关滤波推导/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="soldatJiang">
      <meta itemprop="description" content="一个有上进心的普通人">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="soldatJiang的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">清晰易懂版相关滤波推导

              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2019-06-14 00:52:40 / 修改时间：01:34:51" itemprop="dateCreated datePublished" datetime="2019-06-14T00:52:40+08:00">2019-06-14</time>
            

            
              

              
            
          </span>

          

          
            
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>读研期间做相关滤波视觉跟踪，读了很多相关滤波的论文，但是由于当年矩阵论和数字信号处理基础太菜，一直没搞明白相关滤波的闭合解是怎么推出来的，各种论文里面的推导都是直接给个结果，过程不详。最近终于搞明白了推导的过程和原理，在这里记录一下。我觉得应该是全网最清晰最易懂的相关滤波推导了。</p>
<p>如果不加说明，以下粗体字$\mathbf{x}$代表列向量，加帽$\hat{\mathbf{x}}$代表$\mathbf{x}$的傅里叶变换</p>
<p>在推导之前首先回顾几个定理：</p>
<p><strong>循环卷积定理</strong> 若$\mathbf{x}$的傅里叶变换为$\hat{\mathbf{x}}$，$\mathbf{y}$的傅里叶变换为$\hat{\mathbf{y}}$，则$\mathbf{x}$与$\mathbf{y}$的卷积$\mathbf{x}\otimes\mathbf{y}$的傅里叶变换为$\hat{\mathbf{x}}$与$\hat{\mathbf{y}}$的点积$\hat{\mathbf{x}}\odot\hat{\mathbf{y}}$。</p>
<p><strong>帕斯瓦尔定理</strong><br>$$<br>||\mathbf{x}||^2=\frac{1}{N}||\hat{\mathbf{x}}||^2<br>$$<br>$N$为信号长度。</p>
<p>还有一个小结论，<strong>信号的反序的傅里叶变换等于原信号傅里叶变换的共轭</strong></p>
<p>证明一下，记$\mathbf{y}$为$\mathbf{x}$的反序，即$\mathbf{y}[k]=\mathbf{x}[N-k]$<br>$$<br>\hat{\mathbf{y}}[k]=\sum_{n=0}^{N-1}\mathbf{x}[N-n]e^{-j\frac{2\pi}{N}n}<br>$$<br>令$N-n=t$<br>$$<br>\hat{\mathbf{y}}[k]=\sum_{t=0}^{N-1}\mathbf{x}[t]e^{-j\frac{2\pi}{N}(N-t)}\<br>=\sum_{t=0}^{N-1}\mathbf{x}[t]e^{j\frac{2\pi}{N}t}=\hat{\mathbf{x}^{\ast}}[k]<br>$$</p>
<p>在卷积操作中，信号要经过反褶操作，而信号的互相关没有经过反褶操作，因此则$\mathbf{x}$与$\mathbf{y}$的互相关$\mathbf{x}\ast\mathbf{y}$的傅里叶变换为$\hat{\mathbf{x}^{\ast}}$与$\hat{\mathbf{y}}$的点积$\hat{\mathbf{x}^{\ast}}\odot\hat{\mathbf{y}}$</p>
<p>有了这几个定理，现在开始推导吧。</p>
<p>相关滤波是要学习一个与$\mathbf{x}$维度相同的滤波器$\mathbf{h}$，使两者的互相关$\mathbf{h}\ast\mathbf{x}$尽量接近目标函数$\mathbf{y}$，使下面的目标函数最小。<br>$$<br>E(\mathbf{h})=||\mathbf{h}\ast\mathbf{x}-\mathbf{y}||^2+\lambda||\mathbf{h}||^2<br>$$<br>根据帕斯瓦尔定理，最小化上式相当于最小化<br>$$<br>E(\hat{\mathbf{h}})=||\hat{\mathbf{h}}\odot\hat{\mathbf{x}}-\hat{\mathbf{y}}||+\lambda||\mathbf{h}||^2<br>$$<br>把点积写成矩阵相乘的形式<br>$$<br>E(\hat{\mathbf{h}})=||diag(\hat{\mathbf{x}})\hat{\mathbf{h}}-\hat{\mathbf{y}}||+\lambda||\mathbf{h}||^2<br>$$<br>往下推还需要知道几个结论<br>$$<br>||\mathbf{x}||^2=\mathbf{x}^H\mathbf{x}<br>$$<br>H表示共轭转置<br>$$<br>\frac{\partial \mathbf{x^TAx}}{\partial \mathbf{x}}=\mathbf{A+A^T}<br>$$</p>
<p>$$<br>\frac{\partial \mathbf{x^T a}}{\partial \mathbf{x}}=\frac{\partial \mathbf{a^T x}}{\partial \mathbf{x}}=\mathbf{a}<br>$$</p>
<p>接着往下推<br>$$<br>E(\hat{\mathbf})=(diag(\hat{\mathbf{x}})\hat{\mathbf{h}}-\hat{\mathbf{y}})^{H}(diag(\hat{\mathbf{x}})\hat{\mathbf{h}}-\hat{\mathbf{y}})+\lambda \mathbf{h}^{H} \mathbf{h}<br>$$<br>$$<br>E(\hat{\mathbf})=\hat{\mathbf{h}}^{H}diag(\hat{\mathbf{x}^{\ast}}) diag(\hat{\mathbf{x}})\hat{\mathbf{h}}-\hat{\mathbf{h}}^{H} diag(\hat{\mathbf{x}^{\ast}})\hat{\mathbf{y}}-\hat{\mathbf{y}}^{H} diag(\hat{\mathbf{x}})\hat{\mathbf{h}}+\hat{\mathbf{y}}^{H}\hat{\mathbf{y}}+\lambda \mathbf{h}^{H}\mathbf{h}<br>$$</p>
<p>将目标函数对$\hat{\mathbf{h}}$求偏导(共轭转置和转置不太一样，但是验证一下也是成立的)<br>$$<br>\frac{\partial E(\hat{\mathbf{h}})}{\partial \hat{\mathbf{h}}}=2 diag(\hat{\mathbf{x}^{\ast}}\odot{\hat{\mathbf{x}}})\hat{\mathbf{h}}-2 diag(\hat{\mathbf{x}^{\ast}})\hat{\mathbf{y}}+2\lambda \hat{\mathbf{h}}<br>$$<br>令$\frac{\partial E(\hat{\mathbf{h}})}{\partial \hat{\mathbf{h}}}=0$，解得<br>$$<br>\hat{\mathbf{h}}=(diag(\hat{\mathbf{x}^{\ast}}\odot{\hat{\mathbf{x}}})+\lambda I)^{-1}diag(\hat{\mathbf{x}^{\ast}})\hat{\mathbf{y}}<br>$$</p>
<p>$$<br>\hat{\mathbf{h}}=\frac{\hat{\mathbf{x}^{\ast}}\odot\hat{\mathbf{y}}}{\hat{\mathbf{x}^{\ast}}\odot{\hat{\mathbf{x}}}+\lambda}<br>$$</p>
<p>这就是论文里常见的那个公式的由来了。</p>

      
    </div>

    

    
    
    

    

    
      
    
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/科研/" rel="tag"># 科研</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/04/13/Reliable-Re-Detection-for-Long-Term-Tracking笔记/" rel="next" title="Reliable Re-Detection for Long-Term Tracking笔记">
                <i class="fa fa-chevron-left"></i> Reliable Re-Detection for Long-Term Tracking笔记
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      

      <div class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">soldatJiang</p>
              <div class="site-description motion-element" itemprop="description">一个有上进心的普通人</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">7</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">4</span>
                    <span class="site-state-item-name">标签</span>
                  
                </div>
              
            </nav>
          

          

          

          

          

          
          

          
            
          
          

        </div>
      </div>

      

      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">soldatJiang</span>

  

  
</div>


  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.8.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> v7.1.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/utils.js?v=7.1.0"></script>

  <script src="/js/motion.js?v=7.1.0"></script>



  
  


  <script src="/js/affix.js?v=7.1.0"></script>

  <script src="/js/schemes/pisces.js?v=7.1.0"></script>



  
  <script src="/js/scrollspy.js?v=7.1.0"></script>
<script src="/js/post-details.js?v=7.1.0"></script>



  


  <script src="/js/next-boot.js?v=7.1.0"></script>


  

  

  

  


  


  




  

  

  
  

  
  

  
    
      <script type="text/x-mathjax-config">
  

  MathJax.Hub.Config({
    tex2jax: {
      inlineMath: [ ['$', '$'], ['\\(', '\\)'] ],
      processEscapes: true,
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    TeX: {
      
      equationNumbers: {
        autoNumber: 'AMS'
      }
    }
  });
  MathJax.Hub.Register.StartupHook('TeX Jax Ready', function() {
    MathJax.InputJax.TeX.prefilterHooks.Add(function(data) {
      if (data.display) {
        var next = data.script.nextSibling;
        while (next && next.nodeName.toLowerCase() === '#text') { next = next.nextSibling }
        if (next && next.nodeName.toLowerCase() === 'br') { next.parentNode.removeChild(next) }
      }
    });
  });
</script>

<script type="text/x-mathjax-config">
  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for (i = 0; i < all.length; i += 1) {
      document.getElementById(all[i].inputID + '-Frame').parentNode.className += ' has-jax';
    }
  });
</script>
<script src="//cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><!-- hexo-inject:begin --><!-- Begin: Injected MathJax -->
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({"tex2jax":{"inlineMath":[["$","$"],["\\(","\\)"]],"skipTags":["script","noscript","style","textarea","pre","code"],"processEscapes":true},"TeX":{"equationNumbers":{"autoNumber":"AMS"}}});
</script>

<script type="text/x-mathjax-config">
  MathJax.Hub.Queue(function() {
    var all = MathJax.Hub.getAllJax(), i;
    for(i=0; i < all.length; i += 1) {
      all[i].SourceElement().parentNode.className += ' has-jax';
    }
  });
</script>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js">
</script>
<!-- End: Injected MathJax -->
<!-- hexo-inject:end -->

    
  


  

  

  

  

  

  

  

  

  

  

  

</body>
</html>
